package com.example.wuqujingdianphone.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.wuqujingdianphone.R;
import com.example.wuqujingdianphone.api.ApiConfig;
import com.example.wuqujingdianphone.bean.BookListBean;
import com.example.wuqujingdianphone.bean.BookListBean2;

import java.util.List;

/**
 * Created by yuanpk on 2018/4/9.
 */

public class BCBookAdapter extends BaseQuickAdapter<BookListBean2, BaseViewHolder> {

    private Context mContext;

    public BCBookAdapter(Context context, @Nullable List<BookListBean2> data) {
        super(R.layout.item_book_list, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, BookListBean2 item) {


        Glide.with(mContext)
                .load(ApiConfig.APP_URL + item.spic)
                .error(R.drawable.icon_book_cover_defalt)
                .placeholder(R.drawable.icon_book_cover_defalt)
                .centerCrop()
                .into((ImageView) helper.getView(R.id.image));

        helper.setText(R.id.book_name, item.news_tit);
                /*.setText(R.id.author, "作者：" + item.author)*/

    }
}
